/* 
 * References:
 * "The 80% of UI Design - Typography" https://www.youtube.com/watch?v=9-oefwZ6Z74
 * "Modular scale" https://design-system.economist.com/foundations/typography/modular-scale#type-scale
 * "Line-height" https://design-system.economist.com/foundations/typography/line-height#multipliers
 * "Responsive And Fluid Typography With vh And vw Units" https://www.smashingmagazine.com/2016/05/fluid-typography/
 */

:root {
    /* https://tailwindcss.com/docs/colors */
    /* https://gist.github.com/guvener/d8952570d5a8be430580b93800519439 */
    --neutral-50: #FAFAFA;
    --neutral-100: #F5F5F5;
    --neutral-200: #E5E5E5;
    --neutral-300: #D4D4D4;
    --neutral-400: #A3A3A3;
    --neutral-500: #737373;
    --neutral-600: #525252;
    --neutral-700: #404040;
    --neutral-800: #262626;
    --neutral-900: #171717;
    --red-500: #EF4444;
    --red-600: #DC2626;
    --red-700: #B91C1C;
    --yellow-100: #FEF9C3;
    --yellow-400: #FACC15;
    --yellow-500: #EAB308;
    --green-500: #22C55E;
    --green-600: #16A34A;

    /* typography */
    /* Major Second */
    --font-scale: 1.125;
    --font-family: ui-sans-serif, system-ui, sans-serif;
    --font-family-code: ui-monospace, monospace;
    /* 1rem * pow(var(--font-scale), 6) */
    --h1: 600 2.027rem/1.2 var(--font-family);
    /* 1rem * pow(var(--font-scale), 5) */
    --h2: 600 1.802rem/1.2 var(--font-family);
    /* 1rem * pow(var(--font-scale), 4) */
    --h3: 600 1.602rem/1.2 var(--font-family);
    /* 1rem * pow(var(--font-scale), 3) */
    --h4: 600 1.424rem/1.2 var(--font-family);
    /* 1rem * pow(var(--font-scale), 2) */
    --h5: 600 1.266rem/1.2 var(--font-family);
    /* 1rem * pow(var(--font-scale), 1) */
    --h6: 600 1.125rem/1.2 var(--font-family);
    /* https://m3.material.io/styles/typography/applying-type */
    --p1: normal 1rem/1.5 var(--font-family);
    /* 1rem / var(--font-scale) */
    --sm: normal 0.889rem/1.4 var(--font-family);
    --code: normal 0.889rem/1.4 var(--font-family-code);

    /* spacing - 4px-based system */
    /* https://medium.com/dwarves-design/the-principle-of-spacing-in-ui-design-part-1-3354d0d65e51 */
    --spacing-1: 4px;
    --spacing-2: 8px;
    --spacing-3: 12px;
    --spacing-4: 16px;
    --spacing-5: 20px;
    --spacing-6: 24px;
    --spacing-8: 32px;

    /* elevation */
    --shadow-1: rgba(0, 0, 0, 0.01) 0px 1px 3px 0px, rgba(0, 0, 0, 0.10) 0px 1px 3px 0px;
    --shadow-2: rgba(0, 0, 0, 0.10) 0px 1px 3px 0px, rgba(0, 0, 0, 0.10) 0px 1px 3px 0px;
    /* tailwind #37 https://getcssscan.com/css-box-shadow-examples */
    --shadow-3: rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.06) 0px 2px 4px -1px;
    /* tailwind #38 https://getcssscan.com/css-box-shadow-examples */
    --shadow-4: rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;
    /* tailwind #40 https://getcssscan.com/css-box-shadow-examples */
    --shadow-5: rgba(0, 0, 0, 0.25) 0px 25px 50px -12px;
    --shadow-6: rgba(0, 0, 0, 0.1) 0px -10px 15px -3px;

    /* globals */
    --mobile-navbar-height: 60px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);

    /* z-index layers */
    --z-base: 1;
    --z-modal: 2;
    --z-popover: 3;
    --z-critical: 4;

    /* layout dimensions */
    --sidebar-width: 220px;
    --notes-list-width: 280px;
    --notes-editor-max-width: 850px;

    /* transitions */
    --transition-fast: 150ms;
    --transition-normal: 300ms;

    /* text colors */
    --text-primary: var(--neutral-700);
    --text-secondary: var(--neutral-400);
    --bg-primary: #FFF;
    --bg-secondary: var(--neutral-50);
    --bg-tertiary: var(--neutral-100);
}

@media (prefers-color-scheme: dark) {
    :root {
        --neutral-50: #171717;
        --neutral-100: #262626;
        --neutral-200: #404040;
        --neutral-300: #525252;
        --neutral-400: #737373;
        --neutral-500: #A3A3A3;
        --neutral-600: #D4D4D4;
        --neutral-700: #E5E5E5;
        --neutral-800: #F5F5F5;
        --neutral-900: #FAFAFA;
        --red-600: #991B1B;
        --red-700: #B91C1C;
        --yellow-100: #A16207;

        /* elevation - darker shadows for dark mode */
        --shadow-1: rgba(0, 0, 0, 0.2) 0px 1px 3px 0px, rgba(0, 0, 0, 0.3) 0px 1px 3px 0px;
        --shadow-2: rgba(0, 0, 0, 0.3) 0px 1px 3px 0px, rgba(0, 0, 0, 0.3) 0px 1px 3px 0px;
        --shadow-3: rgba(0, 0, 0, 0.3) 0px 4px 6px -1px, rgba(0, 0, 0, 0.2) 0px 2px 4px -1px;
        --shadow-4: rgba(0, 0, 0, 0.3) 0px 10px 15px -3px, rgba(0, 0, 0, 0.2) 0px 4px 6px -2px;
        --shadow-5: rgba(0, 0, 0, 0.5) 0px 25px 50px -12px;
        --shadow-6: rgba(0, 0, 0, 0.3) 0px -10px 15px -3px;

        /* text and background colors for dark mode */
        --text-primary: var(--neutral-700);
        --text-secondary: var(--neutral-400);
        --bg-primary: #121212;
        --bg-secondary: var(--neutral-50);
        --bg-tertiary: var(--neutral-100);
    }
}

/* Explicit theme overrides */
[data-theme="dark"] {
    --neutral-50: #171717;
    --neutral-100: #262626;
    --neutral-200: #404040;
    --neutral-300: #525252;
    --neutral-400: #737373;
    --neutral-500: #A3A3A3;
    --neutral-600: #D4D4D4;
    --neutral-700: #E5E5E5;
    --neutral-800: #F5F5F5;
    --neutral-900: #FAFAFA;
    --red-600: #991B1B;
    --red-700: #B91C1C;
    --yellow-100: #A16207;

    /* elevation - darker shadows for dark mode */
    --shadow-1: rgba(0, 0, 0, 0.2) 0px 1px 3px 0px, rgba(0, 0, 0, 0.3) 0px 1px 3px 0px;
    --shadow-2: rgba(0, 0, 0, 0.3) 0px 1px 3px 0px, rgba(0, 0, 0, 0.3) 0px 1px 3px 0px;
    --shadow-3: rgba(0, 0, 0, 0.3) 0px 4px 6px -1px, rgba(0, 0, 0, 0.2) 0px 2px 4px -1px;
    --shadow-4: rgba(0, 0, 0, 0.3) 0px 10px 15px -3px, rgba(0, 0, 0, 0.2) 0px 4px 6px -2px;
    --shadow-5: rgba(0, 0, 0, 0.5) 0px 25px 50px -12px;
    --shadow-6: rgba(0, 0, 0, 0.3) 0px -10px 15px -3px;

    /* text and background colors for dark mode */
    --text-primary: var(--neutral-700);
    --text-secondary: var(--neutral-400);
    --bg-primary: #121212;
    --bg-secondary: var(--neutral-50);
    --bg-tertiary: var(--neutral-100);
}

[data-theme="light"] {
    --neutral-50: #FAFAFA;
    --neutral-100: #F5F5F5;
    --neutral-200: #E5E5E5;
    --neutral-300: #D4D4D4;
    --neutral-400: #A3A3A3;
    --neutral-500: #737373;
    --neutral-600: #525252;
    --neutral-700: #404040;
    --neutral-800: #262626;
    --neutral-900: #171717;
    --red-500: #EF4444;
    --red-600: #DC2626;
    --red-700: #B91C1C;
    --yellow-100: #FEF9C3;
    --yellow-400: #CA8A04;
    --yellow-500: #EAB308;
    --green-500: #22C55E;
    --green-600: #16A34A;

    /* elevation */
    --shadow-1: rgba(0, 0, 0, 0.01) 0px 1px 3px 0px, rgba(0, 0, 0, 0.10) 0px 1px 3px 0px;
    --shadow-2: rgba(0, 0, 0, 0.10) 0px 1px 3px 0px, rgba(0, 0, 0, 0.10) 0px 1px 3px 0px;
    --shadow-3: rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.06) 0px 2px 4px -1px;
    --shadow-4: rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;
    --shadow-5: rgba(0, 0, 0, 0.25) 0px 25px 50px -12px;
    --shadow-6: rgba(0, 0, 0, 0.1) 0px -10px 15px -3px;

    /* text colors */
    --text-primary: var(--neutral-700);
    --text-secondary: var(--neutral-400);
    --bg-primary: #FFF;
    --bg-secondary: var(--neutral-50);
    --bg-tertiary: var(--neutral-100);
}

* {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizelegibility;
}

html {
    /* 1rem */
    font-size: 16px;
    height: 100%;
    overflow: hidden;
    margin: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
}

body {
    display: flex;
    font: var(--p1);
    /* https://uxmovement.com/content/why-you-should-never-use-pure-black-for-text-or-backgrounds/ */
    color: var(--text-primary);
    background-color: var(--bg-primary);
    height: 100%;
    overflow: hidden;
    margin: 0;
}

svg.lucide {
    width: 36px;
    height: 36px;

    line,
    circle,
    rect,
    path {
        stroke-width: 2;
        stroke: var(--neutral-500);
    }
}

.page-container {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.button-container {
    display: flex;
    position: relative;
    padding: 0;
    border: 0;
    background: none;
}


.button-group {
    display: flex;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-1) var(--spacing-2);
    margin-right: var(--spacing-1);
    margin-bottom: var(--spacing-1);
    border-radius: 4px;
    font-weight: 500;
    color: var(--neutral-400);
    background-color: var(--neutral-100);
    font-size: 14px;
    transition-property: color, background-color;
    transition-duration: var(--transition-normal);
    cursor: pointer;
    text-decoration: none;
    user-select: none;

    svg.lucide {
        height: 14px;
        width: 14px;
        margin-left: var(--spacing-1);

        line,
        circle,
        rect,
        path {
            stroke: var(--neutral-400);
        }
    }

    &:hover {
        color: var(--neutral-500);
        background-color: var(--neutral-200);
    }

    &:active {
        transform: scale(0.97);
        transition: transform var(--transition-fast) ease-out;
    }
}